package git.soulbgm.common.pojo;

/**
 * 前端返回统一状态code和消息
 *
 * @author SoulBGM
 * @version V1.0
 * @date 2019-09-23 00:09:20
 */
public enum ReturnCode {

    //返回成功信息
    SUCCESS(0,"成功"),

    SAVE_FAIL(1, "添加失败"),

    REMOVE_FAIL(2, "添加失败"),

    UPDATE_FAIL(3, "修改失败"),

    INVALID_FAIL(4, "此ID不存在"),

    FIND_FAIL(5, "查询失败"),

    WRONG_FORMAT(400,"格式错误"),

    ERROR2(200,"token值无效，需要重新登录"),

    ERROR3(300,"没有权限"),

    ERROR4(400,"没找到被操作的数据"),

    ERROR4_1(401,"没找到指定用户的数据"),

    ERROR5(500,"服务不可用"),

    ERROR6(600,"字数超过限制"),

    ERROR7(700,"后台出现异常错误"),

    ERROR10(1000,"具体的业务错误"),

    // TODO 登录相关返回信息

    LOGIN_SUCCESS(0, "登录成功"),

    LOGOUT_SUCCESS(0, "注销成功"),

    HAS_LOGGED(0, "已登录"),

    LOGIN_FAIL(-1, "登录失败"),

    UNKNOWN_ACCOUNT(-1, "未知账户"),

    ACCOUNT_LOCKED(-1, "账户已锁定"),

    USERNAME_OR_PASSWORD_IS_INCORRECT(-1, "用户名或密码不正确"),

    TOO_MANY_INCORRECT_USERNAME_OR_PASSWORD(-1, "用户名或密码错误次数过多"),

    // TODO 权限相关返回信息

    NO_SUCH_PERMISSION(-2, "没有此权限"),

    NO_LOGIN(-2, "请先登录"),

    // 压底的(●'◡'●)
    END(0,"");

    int code;
    String msg;

    ReturnCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
